package com.example.work.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.work.entity.TbCheckAreaScore;
import com.example.work.entity.TbCheckDeficiency;
import com.example.work.entity.TbCheckItemScore;
import com.example.work.mapper.TbCheckDeficiencyMapper;
import com.example.work.service.ITbCheckDeficiencyService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class TbCheckDeficiencyServiceImpl extends ServiceImpl<TbCheckDeficiencyMapper, TbCheckDeficiency> implements ITbCheckDeficiencyService {

    @Override
    public boolean AreaDeficiency(TbCheckAreaScore tbCheckAreaScore,  String remark) {
        TbCheckDeficiency deficiency = new TbCheckDeficiency();

        deficiency.setObjectScoreId(tbCheckAreaScore.getId());
        deficiency.setAreaId(tbCheckAreaScore.getAreaId());
        deficiency.setCategoryId(tbCheckAreaScore.getCategoryId());
        deficiency.setBatchId(tbCheckAreaScore.getBatchId());
//        deficiency.setGridId(grid_id);
        deficiency.setHospId(tbCheckAreaScore.getHospId());
        deficiency.setCreateTime(LocalDateTime.now());
        deficiency.setCreateBy(tbCheckAreaScore.getCreateBy());
        deficiency.setRemark(remark);
        deficiency.setDeleteFlag(false);

        return this.save(deficiency);
    }

    @Override
    public boolean AreaItemDeficiency(TbCheckDeficiency deficiency) {

        return this.save(deficiency);

    }
}